package org.afs.gescol.gwt.client.service;

import org.afs.gescol.gwt.shared.EleveDetailsModel;
import org.afs.gescol.gwt.shared.EleveModel;
import org.afs.gescol.gwt.shared.SearchCriteriaModel;
import org.scub.foundation.framework.gwt.module.client.exception.GwtRunTimeExceptionGwt;
import org.scub.foundation.framework.gwt.module.shared.pagination.RemotePagingCriteriasModel;
import org.scub.foundation.framework.gwt.module.shared.pagination.RemotePagingResultsModel;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * For all eleve's services.
 * @autor Kobla GBENYO (kobla.gbenyo@gmail.com)
 */
@RemoteServiceRelativePath("handler/eleveServices")
public interface EleveServicesGwt extends RemoteService {

    /** For getting instance of async service. */
    public static final class App {
        private static EleveServicesGwtAsync app = null;

        /**
         * Private Constructor.
         */
        private App() {}

        /**
         * Get async service instance.
         * @return the service.
         */
        public static synchronized EleveServicesGwtAsync getInstance() {
            if (app == null) {
                app = (EleveServicesGwtAsync) GWT.create(EleveServicesGwt.class);
            }
            return app;
        }
    }

    /**
     * Get the eleves.
     * @return the eleves
     * @throws GwtRunTimeExceptionGwt Gwt error
     */
    RemotePagingResultsModel<EleveModel> getListElevesByCriterias(RemotePagingCriteriasModel<SearchCriteriaModel> criterias)
            throws GwtRunTimeExceptionGwt;

    /**
     * Get eleve by its id.
     * @return the eleves on details
     * @throws GwtRunTimeExceptionGwt Gwt error
     */
    EleveDetailsModel getEleveById(Long id) throws GwtRunTimeExceptionGwt;

    /**
     * Delete eleve.
     * @throws GwtRunTimeExceptionGwt Gwt error
     */
    void deleteEleveById(Long id) throws GwtRunTimeExceptionGwt;

}
